using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Travel.Library
{
    public partial class TestLibrary : Form
    {
        private Travel.Library.DBCaller objCaller = new DBCaller();       

        public TestLibrary()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            bool flag = objCaller.ExecuteNonQuery("SELECT * FROM BK_BOOKING", 1, false);
            if (flag == true)
                MessageBox.Show("Succesfull Execute Query");                     
        }
        
        private void button2_Click(object sender, EventArgs e)
        {
            bool flag = objCaller.ExecuteNonQuery("CALL SP_BK_BOOKING_SELECT", 2, false);
            if (flag == true)
                MessageBox.Show("Succesfull Execute Query");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            objCaller.paramName = new string[1] { "p_ACCOUNTID" };
            objCaller.paramValue = new object[1];
            objCaller.paramValue[0] = "3001";
            bool flag = objCaller.ExecuteNonQuery("{CALL SP_AC_MEMBER_INSERT(?)}", 2, true);
            if (flag == true)
                MessageBox.Show("Succesfull Execute Query");
        }

        private void button4_Click(object sender, EventArgs e)
        {
            objCaller.paramNames = new string[2,1];
            objCaller.paramNames[0,0] = "p_ACCOUNTID";
            objCaller.paramNames[1,0] = "p_ACCOUNTID";
            objCaller.paramValues = new object[2,1];
            objCaller.paramValues[0,0] = "3001";
            objCaller.paramValues[1,0] = "3001";
            objCaller.AddQuery("{CALL SP_AC_MEMBER_INSERT(?)");
            objCaller.AddQuery("{CALL SP_AC_MEMBER_INSERT(?)");
            objCaller.ExecuteQueries(objCaller.i_StoreProcedure, objCaller.paramNames, objCaller.paramValues);
        }
    }
}